<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>密码找回</title>
<base href="${pageContext.request.contextPath }/">
<script type="text/javascript" src="js/jquery.1.11.1.js"></script>
<link href="css/bootstrap.min.css-v=3.3.5.css" rel="stylesheet">
<link href="css/style.min.css-v=4.0.0.css" rel="stylesheet">
<base target="_blank">
</head>
<body>

	<div class="middle-box text-center loginscreen  animated fadeInDown">
		<div>

			<h3>密码找回</h3>

			<div class="form-group">
				<input type="email" class="form-control" id="student_num"
					placeholder="用户名" required="">
			</div>
			<div class="form-group">
				<input type="text" class="form-control" placeholder="注册邮箱"
					id="email" required="">
			</div>
			<button type="submit" class="btn btn-primary block full-width m-b"
				onclick="sure();">确认找回</button>
			<script type="text/javascript">
function sure()
{      
	var password;
	var error;
	   var number=document.getElementById("student_num").value;
	   var email=document.getElementById("email").value;
	   var useremail;
	   $.ajax({
      　　　　 url:'${pageContext.request.contextPath }/user/password',  /*  //ajax传数据到后台 */
              data:{
                  email: email,
                  number:number
              },
              type:"post",
              async:false,
              dataType:"json",
              success:function(data){
            	  password=data.password;
            	  useremail=data.useremail;
            	  error=data.error
              }
          }); 	
	if(error=="用户不存在")
		alert(error);
	else{	
	if(email==useremail)
		{
		alert(password);
		alert("密码已经发送到"+useremail+"请注意查收")
		}
	else
	{
	alert("邮箱错误");
	}
	}
}
</script>
		</div>
	</div>
</body>
</html>